<template>
  <div class="detail-description">
    <div class="download-area">
      <span
        class="android-download"
        @click="window.open(detailData.download_url, '_blank')"
      >下载</span>
      <span
        class="ios-download"
        @click="window.open(detailData.download_url, '_blank')"
      >获取</span>
    </div>
    <div class="view-follow-area">
      <p>浏览 <span>{{ detailData.views ? detailData.views: 0 }}</span></p>
      <p>关注 <span>{{ detailData.attention_count ? detailData.attention_count : 0 }}</span></p>
    </div>
    <div class="app-description-area">
      <p>介绍</p>
      <p>{{ detailData.description ? detailData.description : '' }}</p>
    </div>
    <div class="screenshot-area">
      <el-carousel
        type="card"
        height="200px"
      >
        <el-carousel-item
          v-for="item in detailData.screenShots"
          :key="item.app_scr_id"
        >
          <div class="image-wrapper">
            <el-image
              :src="item.app_scr_url"
              fit="cover"
              style="width: 100%; height: 200px"
              :preview-src-list="detailData.screenShots.map(item => item.app_scr_url)"
            ></el-image>
          </div>
        </el-carousel-item>
      </el-carousel>
    </div>
  </div>
</template>

<script>
export default {
  name: 'DetailDescription',
  props: {
    detailData: Object
  },
  data () {
    return {
      window: window
    }
  }
}
</script>

<style lang="scss" scoped>
  .detail-description {
    width: 600px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 0 20px 20px 20px;
    .download-area {
      display: flex;
      justify-content: space-between;
      align-items: center;
      width: 100%;
      // padding: 10px;
      .android-download,
      .ios-download {
        flex: 1;
        position: relative;
        background-color: #15C5CE;
        height: 42px;
        border-radius: 20px;
        color: #fff;
        text-align: center;
        line-height: 42px;
        cursor: pointer;
      }
      .android-download {
        margin-right: 16px;
        &::before {
          display: block;
          width: 24px;
          height: 24px;
          position: absolute;
          top: 8px;
          left: 90px;
          background: url(./images/icon-android.svg) center center / cover no-repeat;
          content: "";
        }
      }
      .ios-download {
        margin-right: 16px;
        &::before {
          display: block;
          width: 24px;
          height: 24px;
          position: absolute;
          top: 6px;
          left: 90px;
          background: url(./images/icon-ios.svg) center center / cover no-repeat;
          content: "";
        }
      }
    }
    .view-follow-area {
      display: flex;
      width: 100%;
      padding: 10px;
      p {
        color: #ccc;
        span {
          color: #999;
        }
        &:nth-of-type(2n+1) {
          margin-right: 20px;
        }
      }
    }
    .app-description-area {
      width: 100%;
      padding: 10px;
      p {
        color: #ccc;
        &:nth-of-type(2n+1) {
          line-height: 30px;
        }
        &:nth-of-type(2n+2) {
          color: #999;
        }
      }
    }
    .screenshot-area {
      height: 200px;
      width: 100%;
      padding: 0 10px 10px 10px;
      .image-wrapper {
        height: 200px;
      }
    }
  }
</style>